require("./env.config/index"); // 再次处理 process.env 变量
let path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  productionSourceMap: false, // 不输出map文件
  // 去除console
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === "production") {
      config.optimization.minimizer[0].options.terserOptions.compress.warnings = false;
      config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true;
      config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true;
      config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = [
        "console.log",
      ];
    }
  },
  chainWebpack: (config) => {
    config.resolve.alias.set("Buic", resolve("src/components/Buic"));
  },
  transpileDependencies: ["uni-simple-router"],
};
